//
//  HMUser.swift
//  iOSWeibo12
//
//  Created by Admin on 16/9/11.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit

class HMUser: NSObject {
    /// 用户UID
    var id: Int = 0
    
    /// 友好显示名称
    var name: String?
    
    /// 用户头像地址（中图），50×50像素
    var profile_image_url: String?
    
    /// verified_type 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type: Int = -1
    
    /// 会员等级 1-6
    var mbrank: Int = 0
    
    // MARK: - 字典转模型
    init(dict: [String: Any]) {
        super.init()
        
        // KVC赋值
        setValuesForKeys(dict)
    }
    
    // 字典中的key在模型中没有对应的属性时调用
    override func setValue(_ value: Any?, forUndefinedKey key: String) {}
    
    // 打印对象
    override var description: String {
        let keys = ["id", "name", "profile_image_url", "verified_type", "mbrank"]
        return "\n\t\t:用户模型:\(dictionaryWithValues(forKeys: keys))\n"
    }
}
